package com.sixth.volunteerservicesystem.ServiceImpl;

import com.sixth.volunteerservicesystem.Dao.LoginDao;
import com.sixth.volunteerservicesystem.Service.LoginService;
import com.sixth.volunteerservicesystem.domain.Admins;
import com.sixth.volunteerservicesystem.domain.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginDao loginDao;

    @Override
    public List<Users> getlogin(String userId, String password) {
        List<Users> list = loginDao.getlogin(userId, password);
        if (list.size() == 0)
            return null;
        else
            return list;
    }
    @Override
    public List<Admins> getloginadmin(String adminId, String password) {
        List<Admins> list = loginDao.getloginadmin(adminId, password);
        if (list.size() == 0)
            return null;
        else
            return list;
    }

    @Override
    public List<Users> getuserbynickname(String nickname) {
        List<Users> list = loginDao.getuserbynickname(nickname);
        if (list.size() == 0)
            return null;
        else
            return list;
    }

    @Override
    public void insertuser(Users users) {
        users.getNickNama();
        loginDao.insertuser(users);
    }

    @Override
    public List<Users> getuserbyid(String userid) {
        List<Users> list = loginDao.getuserbyid(userid);
        if (list.size() == 0)
            return null;
        else
            return list;
    }

}
